package com.server.Config;

import com.api.service.UserServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.remoting.rmi.RmiServiceExporter;

@Configuration
public class RMIServer {
    @Autowired
    private UserServiceI userService;

@Bean
/**
 * 暴露RmiService
 *
 *
 */

    public RmiServiceExporter getRmiServiceExport(){
      RmiServiceExporter rmiServiceExporter=new RmiServiceExporter();
      rmiServiceExporter.setServiceName("userService");
      rmiServiceExporter.setService(userService);
      rmiServiceExporter.setServiceInterface(UserServiceI.class);
      rmiServiceExporter.setRegistryPort(2002);
      return  rmiServiceExporter;
  }
}
